<template>
	<div>
		<Row type="flex" justify="center" class="tips">
			<Col span="24">
			<img v-if="statusData.statusCode!=='2'" src="../../../../assets/img/success.png" alt="">
			<img v-else src="../../../../assets/img/error.png" alt="">
			</Col>
			<Col span="24" class="tips_msg">{{statusData.statusMsg||"参数不合法或者参数为空"}}</Col>
			<Col span="24" class="tips_btn">
			<Button type="error" @click="confirm" v-if="statusData.statusCode==='3'">确定</Button>
			<Button type="error" @click="smallAuthentication" v-if="statusData.statusCode==='0'&&!flag">前往小额鉴权</Button>
			<Button type="error" @click="reIncoming" v-if="statusData.statusCode==='2'">重新提交进鉴材料</Button>
			<Button type="error" @click="goPage" v-if="flag&&statusData.statusCode==='0'">前往申请电子签章</Button>
			</Col>
		</Row>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				reportUrl: "",
				flag: "",
				statusData:{}
			}
		},
		mounted() {
			this.$tools.bk_set_nav_title('状态页面');
			this.getStatus();
		},
		watch: {
			"reportUrl"() {
				if (this.reportUrl != "" && this.reportUrl != null) {
					this.flag = true;
				} else {
					this.flag = false;
				}
			}
		},
		methods: {
			getStatus() {
				let datas = {
					instanceId: JSON.parse(this.transData.formdatas).instanceId,
					number: JSON.parse(this.transData.formdatas).number
				}
				this.$ajax.post(this, this.$api.GET_STATUS_GET, datas,
					(res) => {
						if (res.code == 200) {
							this.statusData=res.data.content;
							if (res.data.content.reportUrl != null) {
								this.reportUrl = res.data.content.reportUrl;
							}
						}
					});
			},
			smallAuthentication() {
				this.$router.push({
					name: "SmallAuthentication",
					query: {
						instanceId: JSON.parse(this.transData.formdatas).instanceId,
						number: JSON.parse(this.transData.formdatas).number,
						verifyNum: this.statusData.verifyNum,
						restartNum: this.statusData.restartNum
					}
				})
			},
			reIncoming() {
				this.$router.push({
					name: "EnterpriseCertification",
					query: {
						instanceId: JSON.parse(this.transData.formdatas).instanceId,
						number: JSON.parse(this.transData.formdatas).number,
						userType: this.$route.query.userType
					}
				})
			},
			confirm() {
				//退出操作
				this.$tools.bk_back();
			},
			goPage() {
				//跳转
				if (this.reportUrl == null) {
					window.alert("未获取到相关信息");
				} else {
					this.$tools.bk_new_page(this.reportUrl , "申请电子签章");
				}
			
			}
		},
		computed: {
			transData() {
				return this.$route.query;
			}
		}
	}
</script>

<style scoped>
	.tips {
		text-align: center;
		padding: 30px;
	}

	.tips div {
		margin-top: 10px;
	}

	.tips .tips_btn {
		margin-top: 30px;
	}
</style>
